package cn.edu.zafu.bigdata.zqt.studentsystem.service.impl;

import cn.edu.zafu.bigdata.zqt.studentsystem.cli.StudentManagerSystem;
import cn.edu.zafu.bigdata.zqt.studentsystem.entity.Student;
import cn.edu.zafu.bigdata.zqt.studentsystem.service.AbstractService;
import cn.edu.zafu.bigdata.zqt.studentsystem.utils.FileUtils;
import cn.edu.zafu.bigdata.zqt.studentsystem.utils.InputUtils;

/**
 * 增加学生
 *
 * @author zqt
 */
public class AddStudent extends AbstractService {

    @Override
    protected void handleUserInput() {
        String id = InputUtils.readId(true);
        String name = InputUtils.readName();
        String phone = InputUtils.readPhone();

        Student student = new Student(id, name, phone);
        StudentManagerSystem.studentList.add(student);
        FileUtils.updateData();
        System.out.println("数据添加成功");
    }
}
